package cn.iocoder.yudao.module.picturebook.dal.mysql.bookgather;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.picturebook.dal.dataobject.bookgather.BookGatherDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.picturebook.controller.admin.bookgather.vo.*;

/**
 * 绘本集合 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BookGatherMapper extends BaseMapperX<BookGatherDO> {

    default PageResult<BookGatherDO> selectPage(BookGatherPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BookGatherDO>()
                .likeIfPresent(BookGatherDO::getGaterName, reqVO.getGaterName())
                .eqIfPresent(BookGatherDO::getImageUrl, reqVO.getImageUrl())
                .eqIfPresent(BookGatherDO::getCategoryId, reqVO.getCategoryId())
                .eqIfPresent(BookGatherDO::getTotal, reqVO.getTotal())
                .betweenIfPresent(BookGatherDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BookGatherDO::getGatherId));
    }

    default List<BookGatherDO> selectListByCategoryId(Integer categoryId){
        return selectList(new LambdaQueryWrapperX<BookGatherDO>()
                .eq(BookGatherDO::getCategoryId, categoryId));
    };
}